import Service from '@/api/httpAxios'

export interface ProcessParamType {
  project_id: string
  fleet_id: string
  url?: string
}

class fleetDetails {
  getFleet = (obj: ProcessParamType) => {
    let pid
    obj.project_id ? (pid = obj.project_id) : (pid = localStorage.getItem('project_id'))
    const url = `/v1/${pid}/monitor-fleets/${obj.fleet_id}`
    return Service.get<any>(url)
  }
  getInbound = (obj: ProcessParamType) => {
    let pid
    obj.project_id ? (pid = obj.project_id) : (pid = localStorage.getItem('project_id'))
    const url = `/v1/${pid}/fleets/${obj.fleet_id}/inbound-permissions`
    return Service.get<any>(url)
  }
  getRunTiem = (obj: ProcessParamType) => {
    let pid
    obj.project_id ? (pid = obj.project_id) : (pid = localStorage.getItem('project_id'))
    const url = `/v1/${pid}/fleets/${obj.fleet_id}/runtime-configuration`
    return Service.get<any>(url)
  }
  getInstanceCap = (obj: ProcessParamType) => {
    let pid
    obj.project_id ? (pid = obj.project_id) : (pid = localStorage.getItem('project_id'))
    const url = `/v1/${pid}/fleets/${obj.fleet_id}/instance-capacity`
    return Service.get<any>(url)
  }
}

export default new fleetDetails()
